﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CrossLayerCommunication.FluentValidation;
using System.Collections.Generic;

namespace UnitTest.FluentValidation
{
    [TestClass]
    public class TestNullability
    {
        [TestMethod]
        public void TestNullableStructNull()
        {
            int? value = null,
                value1 = 10;

            Assert.IsTrue(value.TestingFluentValidation().IsNull().ValidationWasSuccessful);
            Assert.IsFalse(value1.TestingFluentValidation().IsNull().ValidationWasSuccessful);
        }

        [TestMethod]
        public void TestNullableStructNotNull()
        {
            int? value = null,
                value1 = 10; 

            Assert.IsFalse(value.TestingFluentValidation().IsNotNull().ValidationWasSuccessful);
            Assert.IsTrue(value1.TestingFluentValidation().IsNotNull().ValidationWasSuccessful);
        }

        [TestMethod]
        public void TestObjectNull()
        {
            string value = null,
                   value1 = "";

            Assert.IsTrue(value.TestingFluentValidation().IsNull().ValidationWasSuccessful);
            Assert.IsFalse(value1.TestingFluentValidation().IsNull().ValidationWasSuccessful);
        }

        [TestMethod]
        public void TestObjectNotNull()
        {
            List<int> value = null,
                      value1 = new List<int>();

            Assert.IsFalse(value.TestingFluentValidation().IsNotNull().ValidationWasSuccessful);
            Assert.IsTrue(value1.TestingFluentValidation().IsNotNull().ValidationWasSuccessful);
        }
    }
}
